package com.gilight.base.admin;

import java.util.ArrayList;
import java.util.List;

public class excelToMysql {
    public static void main(String[] args) {

        // 读取excel文件
        String filePath = "C:\\Users\\Administrator\\Desktop\\test.xlsx";
        List<List<Object>> list = ExcelUtil.readExcel(filePath);
        //生成ExcelUtil方法
        //读取EXCEL文件



        System.out.println("list:"+list);

        // 将读取的excel文件插入到数据库中
        String sql = "insert into test (name,age) values (?,?)";
        List<Object[]> params = new ArrayList<Object[]>();
        for (int i = 0; i < list.size(); i++) {
            Object[] objects = new Object[list.get(i).size()];
            for (int j = 0; j < list.get(i).size(); j++) {
                objects[j] = list.get(i).get(j);
            }
            params.add(objects);
        }
        System.out.println("params:"+params);
    }
}
